﻿<style>
    .search.input-group {
        width: 300px;
    }
</style>
<div>
    <div class="form-inline pull-right">
        <button class="btn btn-info waves-effect" ng-click="list.GetPageData(paginationConf.currentPage, paginationConf.itemsPerPage);">
            <span class="glyphicon glyphicon-refresh"></span>
        </button>
        <div class="input-group">
            <span class="input-group-addon">全局搜索：</span>
            <div class="fg-line">
                <input type="text" class="form-control" ng-change="search(kw)" ng-model="kw" placeholder="全局搜索" />
            </div>
        </div>
    </div>
    <div class="pull-left">
        <button class="btn btn-primary waves-effect" ng-click="add()">
            <span class="glyphicon glyphicon-plus"></span>
        </button>
    </div>
    <div class="search input-group">
        <span class="input-group-addon">选择应用：</span>
        <div class="ui fluid search selection dropdown apps">
            <input name="apps" type="hidden" id="apps">
            <i class="dropdown icon"></i>
            <div class="default text">选择应用</div>
            <div class="menu">
                <div class="item" ng-repeat="item in apps track by $index" data-value="{{item.AppId}}">{{item.AppName}}</div>
            </div>
        </div>
    </div>
    <table ng-table="list.tableParams" class="table table-bordered table-hover table-condensed editable-table listTable" ng-form="list.tableForm" disable-filter="list.isAdding" tracked-table="list.tableTracker">
        <colgroup>
            <col width="15%" />
            <col width="10%" />
            <col width="10%" />
            <col width="10%" />
            <col width="5%" />
            <col width="25%" />
            <col width="15%" />
        </colgroup>
        <tr ng-repeat="row in $data" ng-form="rowForm" tracked-table-row="row">
            <td title="'功能'" filter="{Name: 'text'}" sortable="'Name'">
                {{row.Name}}
            </td>
            <td title="'控制器名'" filter="{Controller: 'text'}" sortable="'Controller'">
                {{row.Controller}}
            </td>
            <td title="'方法名称'" filter="{Action: 'text'}" sortable="'Action'">
                {{row.Action}}
            </td>
            <td title="'请求方式'" filter="{HttpMethod: 'text'}" sortable="'HttpMethod'">
                {{row.HttpMethod}}
            </td>
            <td title="'可用'">
                <label class="el-switch">
                    <input type="checkbox" name="switch" ng-model="row.IsAvailable">
                    <span class="el-switch-style" ng-click="toggle(row)"></span>
                </label>
            </td>
            <td title="'权限配置'">
                <div class="btn-group">
                    <a class="btn btn-success btn-sm waves-effect" ng-href="#/access/permission/{{row.Id}}">
                        配置权限
                    </a>
                    <a class="btn btn-danger btn-sm waves-effect" ng-click="list.del(row)">
                        更改应用
                    </a>
                </div>
            </td>
            <td title="'操作'" style="width: 155px;">
                <div class="btn-group">
                    <a class="pull-right btn btn-danger waves-effect" data-nodrag ng-click="del(row)">
                        <span class="glyphicon glyphicon-remove"></span>
                    </a>
                    <a class="pull-right btn btn-info waves-effect" data-nodrag ng-click="edit(row)">
                        <span class="glyphicon glyphicon-edit"></span>
                    </a>
                </div>
            </td>
        </tr>
    </table>
    <tm-pagination conf="paginationConf"></tm-pagination>
</div>

<div id="modal" class="modal">
    <div class="container-fluid" style="margin: 15px 0;">
        <form class="bgm-white">
            <div class="input-group">
                <span class="input-group-addon">
                    访问控制名：
                </span>
                <div class="fg-line">
                    <input type="text" class="form-control" id="acl-name" ng-model="acl.Name" />
                </div>
            </div>
            <div class="input-group">
                <span class="input-group-addon">
                    Controller控制器名：
                </span>
                <div class="fg-line">
                    <input type="text" class="form-control" id="acl-controller" ng-model="acl.Controller" />
                </div>
            </div>
            <div class="input-group">
                <span class="input-group-addon">
                    Action方法名：
                </span>
                <div class="fg-line">
                    <input type="text" class="form-control" id="acl-action" ng-model="acl.Action" />
                </div>
            </div>
            <div class="input-group">
                <span class="input-group-addon">
                    Path请求路径：
                </span>
                <div class="fg-line">
                    <input type="text" class="form-control" id="acl-path" ng-model="acl.Path" />
                </div>
            </div>
            <div class="input-group">
                <span class="input-group-addon">
                    HTTP请求方式：
                </span>
                <div class="fg-line">
                    <select class="form-control" ng-model="acl.HttpMethod" ng-options="m.value as m.name for m in HttpMethod">
                        <option value="">请选择请求方式</option>
                    </select>
                </div>
            </div>
            <div class="btn-group">
                <button type="button" class="btn btn-info waves-effect" ng-click="submit(acl)">确认</button>
                <button type="button" class="btn btn-danger waves-effect" ng-click="closeAll()">取消</button>
            </div>
        </form>
    </div>
</div>